package com.lagou.homeWork3.hw4;

import java.util.List;

public class StudentFind {
    public static Student findStudent(int id, List<Student> ls) {
        for (Student student : ls) {
            if (id == student.getId()) {
                return student;             // 遍历List，返回目标
            }
        }
        return null;                        // 如果不存在，则返回null
    }
}
